<template>
    <el-breadcrumb separator="/">
        <el-breadcrumb-item v-for="item in navData" :key="item.path" :to="{ path: item.path }">{{item.meta.title}}</el-breadcrumb-item>
    </el-breadcrumb>
</template>

<script>
export default {
    data(){
        return{
        }
    },  
    created(){
        // console.log(this.$route.matched);
    },
    props:{title:{
      type:String
    }},
    computed:{
      // const emit=defineEmits(['getCurrentPage'])
        navData(){
            let matche = this.$route.matched;
            console.log('---matche----',matche);
            // console.log(this.title);
            if (this.title!==undefined) {
              matche[matche.length-1].meta.title=this.title
            }
            matche.map((item,index,arr)=>{
              // console.log(item.path);
              // console.log(index)
              // console.log(arr)
              if (item.path=='/goods') {
                item.path=arr[2].path
              }
            })
            matche[0].path='/';
            return matche;
        }
    }
}
</script>

<style>

</style>